package com.esiag.isidis.fi.pdsteam.reader;

import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

public class MarshalerXML {
	
	public void marshal( Class clazz, Object object, String fileName) {

		try {

			// create JAXB context and instantiate marshaller
			JAXBContext context = JAXBContext.newInstance( clazz);
			Marshaller m = context.createMarshaller();
			m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

			// Write to File
			m.marshal(object, new File(fileName));

		}
		catch( Exception e) {
			System.out.println(e.toString());
		}
	}

}
